<!DOCTYPE html>
<html>
<head>
	<% include ../link %>
</head>
<body>
	<% include ../head %>
	<div class="row">
		<div class="col-md-8">
			<ul class="nav nav-pills" role="tablist">
				<li role="presentation"><a href="/admin/video">视频管理</a></li>
				<li role="presentation"><a href="/admin/article">文章管理</a></li>
				<li role="presentation"><a href="/admin/users">用户管理</a></li>
				<li role="presentation" class="active"><a href="#">添加管理员</a></li>
			</ul>
		</div>
		<div class="col-md-2">
			<input class="seid form-control" type="text" name="id" placeholder="id">
		</div>
		<div class="col-md-1">
			<button class="select button button-action button-rounded button-small">select</button>
		</div>
	</div>
	<table class="table table-striped">
		<thead>
			<tr>
				<th>imgPath</th>
				<th>href</th>
				<th>motto</th>
			</tr>
		</thead>
		<tbody data-bind="foreach: carousel">
			<tr>
				<th><input type="text" name="imgUrl" data-bind="attr : {value : imgUrl}"></th>
				<th><input type="text" name="hrefUrl" data-bind="attr : {value : hrefUrl}"></th>
				<th><input type="text" name="motto" data-bind="attr : {value : motto}"></th>
				<th><button class="save button button-caution button-rounded button-small">save</button></th>
			</tr>
		</tbody>
	</table>
</body>
<script type="text/javascript">
	
	var car = '<%-JSON.stringify(car)%>';
	car = JSON.parse(car);
	car = car.img

	// console.log(car)

	function ViewModel(){
		var self = this;
		self.carousel = ko.observableArray()
	}

	var vm = new ViewModel();

	function carModel(c){
		var self = this;
		self.imgUrl = c.imgUrl;
		self.hrefUrl = c.hrefUrl;
		self.motto = c.motto
	}

	car.forEach(function(value){
		vm.carousel.push(new carModel(value));
	})

	ko.applyBindings(vm)

	var saveBtn = $('.save');

	saveBtn.on('click', function(){
		// console.log(observableArray())
	})
</script>
</html>